const express = require('express');
const router =express.Router();
const multer= require('multer');
const path = require('path');
const upload = multer({ dest: path.join(__dirname, '../uploads') })
const expressjoi= require('@escook/express-joi');
const {add_article_schema,get_list_schema,delete_article_schema,getid_article_schema,edit_article_schema}=require('../schema/article')
router.post('/add',upload.single('cover_img'),expressjoi(add_article_schema),require('../router_heandler/articles/add_article'))
router.get('/list',require('../router_heandler/articles/get_list'));
router.get('/delete/:id',expressjoi(delete_article_schema),require('../router_heandler/articles/delete_article'))
router.get('/:id',expressjoi(getid_article_schema),require('../router_heandler/articles/selectid_article'))
router.post('/edit',upload.single('cover_img'),expressjoi(edit_article_schema),require('../router_heandler/articles/edit_article'))
module.exports=router;
